#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 3e4 + 10;
typedef long long ll;
int a[N];
ll cnt;
bool cmp(int x, int y)
{
	return x > y;
}
int main()
{
	int w, n;
	cin >> w >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n, cmp);
	int i = 0, j = n - 1;
	while (i <= j)
	{
		if (a[i] + a[j] <= w)
		{
			cnt++;
			i++;
			j--;
		}
		else
		{
			cnt++;
			i++;
		}
	}
	cout << cnt << endl;
	return 0;
}